package com.kgc.controller;

import com.kgc.pojo.Product;
import com.kgc.pojo.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProductController {
//
//    @Value("${serverAddress.activeMQ}")
//    private String address;
//
//    @RequestMapping("showConfig")
//    public String showConfig(){
//        return address;
//    }
//
    @RequestMapping("view/getProductById3")
    public Product getProductById3(Integer productId){
        System.out.println("服务提供者》接收到的条件productId："+productId);
        Product product = new Product(productId,"爽肤水999",99.99);

        return product;
    }

    @RequestMapping("getProductById2")
    public Product getProductById2(Integer productId){
        System.out.println("服务提供者》接收到的条件productId："+productId);
        Product product = new Product(productId,"爽肤水777",99.99);

        return product;
    }


    @Value("${eureka.client.serviceUrl.defaultZone}")
    private String port;

    @RequestMapping("showConfig")
    public String showConfig(){
        return  port;
    }

    @RequestMapping("getProductById")
    public Product getProductById(Integer productId, @RequestBody User user){
        System.out.println("执行了服务提供者getProductById");
        System.out.println("服务提供者》接收到的条件productId："+productId);
        System.out.println("服务提供者》接收到的条件user："+user);
        Product product = new Product(productId,"爽肤水",88.66);

        return product;
    }


}
